import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";

// https://vitejs.dev/config/
export default defineConfig(({mode}) => {
    return {
        plugins: [
            vue()
        ],
        resolve: {
            alias: {
                '@': path.join(__dirname, 'src'),
                '~': path.join(__dirname),
            }
        },
        server: {
            host: '0.0.0.0',
            port: 2222,
            proxy: {
                '/api': {
                    target: 'http://localhost:8081',
                    changeOrigin: true,
                    rewrite: path => path.substring('/api'.length)
                }
            }
        },
        build: {
            assetsDir: `${new Date().getTime()}`
        }
    }
})
